import React, { Component } from 'react';
import LessonUi from '../Ui/LessonUi'
import { connect } from 'react-redux'
import { loadDataAsync } from '../actionCreater'

@connect(
    (state)=>{
        return {
            list:state.lesson.list
        }
    },
    (dispatch)=>({
        loadData(){
            dispatch(loadDataAsync())
        }
    })
)
class Lessson extends Component {
    
    componentDidMount(){
        this.props.loadData()
    }

    render() {
        return (
            <div>
                <LessonUi { ...this.props}></LessonUi>
            </div>
        );
    }
}

export default Lessson;